package common

// SubTopic 订阅的主题
type SubTopic struct {
	Topic string
	Qos   byte
}

// MQTTConnOpt mqtt连接参数
type MQTTConnOpt struct {
	Host     string `yaml:"host"`
	Port     int
	User     string
	Password string
	Clientid string
	Clean    bool
	Subtops  struct {
		Hour    SubTopic
		Fminute SubTopic
		Minute  SubTopic
		Real    SubTopic
		State   SubTopic
		Qc      SubTopic
		Env     SubTopic
		Alarm   SubTopic
	}
}

// SQLConnOpt sql连接参数
type SQLConnOpt struct {
	Type       string
	Host       string
	Port       int
	User       string
	Password   string
	Database   string
	Stationsql string
}

// RedisConnOpt sql连接参数
type RedisConnOpt struct {
	Host     string
	Port     int
	Password string
	Index    int
}

// ServerInfo 网络服务器信息
type ServerInfo struct {
	Host string
	Port int
}

// TaskTime 定时任务时间信息
type TaskTime struct {
	Hour    int
	Fminute int
	Minute  int
	Real    int
	State   int
	Env     int
	Qc      int
	Alarm   int
}

// Config 配置文件信息
type Config struct {
	Rxmqtt  MQTTConnOpt `yaml:"rxmqtt"`
	Sqldb   SQLConnOpt
	Redis   RedisConnOpt
	Times   TaskTime   `yaml:"times"`
	RecvSrv ServerInfo `yaml:"recvsrv"`
	Type    string
	Log     bool
	RPC     struct {
		enable  bool
		address string
	} `yaml:"rpc"`
}
